home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / shell / burden / src / burden.c next >
Encoding:
C/C++ Source or Header  |  1995-05-05  |  3.6 KB  |  177 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <winb.h>
  5. #include <te.h>
  6. #include <fntb.h>
  7. #include <gui.h>
  8. #include <egb.h>
  9. #include <guidbg.h>
  10.  
  11. #include <mos.h>
  12. #include <eintm.h>
  13.  
  14. char    *guiEgbPtr ;            /*    EGB のワークアドレス    */
  15.  
  16. int    masterHyperID = -1 ;
  17. int    iconDialogID = -1 ;
  18. int    iconDummyDButtonID = -1 ;
  19. int    iconQuitIconID = -1 ;
  20. int    iconMessageID = -1 ;
  21.  
  22. char msg[] = "888\0";
  23. unsigned int beforeTime,afterTime;
  24.  
  25. int quitFuncRet = ILLEGAL_FUNCTION ;
  26.  
  27. int userFunc(apliId, messId, info, data)
  28. int    apliId;
  29. int    messId;
  30. int    info;
  31. int    data;
  32. {
  33.     register int    ret;
  34.  
  35.     ret = ILLEGAL_FUNCTION;
  36.  
  37.     switch(messId)
  38.     {
  39.         case    GM_QUIT :
  40.             MMI_SendMessage(iconQuitIconID,MM_EXEC,2,0,0);
  41.             ret = quitFuncRet ;
  42.             break;
  43.     }
  44.  
  45.     return(ret);
  46. }
  47.  
  48. void main()
  49. {
  50.     static MMICTRL mmi ={
  51.                 SCREEN16|SCREENIGNORE,        // ページ0側解像度
  52.                 SCREENUNUSED,                // ページ1側解像度
  53.                 0,                             // 書き込みページ
  54.                 SCREENAVAILABLE,             // 表示ページ
  55.                 0,                             // 表示プライオリティ
  56.                 SCREENAVAILABLE,            // 色数
  57.                 SCREENEXPAND,                 // VRAMの横の長さ
  58.                 0,                             // メモリ領域の大きさ
  59.                 NULL,                         // メモリ領域のアドレス
  60.                 0,                             // ユーザ領域の大きさ
  61.                 NULL,                         // ユーザ領域のアドレス
  62.                 0, 0,                         // 画面枠    lupx,lupy
  63.                 0, 0,                        //            rdwx,rdwy
  64.                 -16384, -16384,                // 移動枠    lupx,lupy
  65.                 16383, 16383,                //            rdwx,rdwy
  66.                 15,                         // 白色
  67.                 8,                          // 黒色
  68.                 7,                          // 灰色
  69.                 6                             // 反転色
  70.     };
  71.  
  72.     extern int APL_init() ;
  73.  
  74.     /*    初期化処理    */
  75.     if (MMI_Open( &mmi ) == NOERR)
  76.     {
  77.         /*    初期化に成功すればメインループに入る.    */
  78.         if (APL_init() == NOERR)
  79.             MMI_ExecSystem() ;
  80.     }
  81.  
  82.     /*    終了処理    */
  83.     MMI_Close() ;
  84.  
  85. }
  86.  
  87. int APL_init()
  88. {
  89.     extern MMIINIT    initDataGUI ;
  90.  
  91.     register int    ret ;
  92.  
  93.     /*    EGB ワークアドレスの取得.    */
  94.     guiEgbPtr = MMI_GetEgbPtr() ;
  95.  
  96.     /*    ユーザアイコン設定        */
  97.     extern unsigned char *iconTbl[];
  98.     extern int iconMaxId;
  99.     MMI_SetIconTable(iconTbl, iconMaxId);
  100.  
  101.     /*    ハイパ型部品の初期化            */
  102.     if ((ret = MMI_initHyper()) < 0)
  103.         return ret ;
  104.     /*    ダイアログ型部品の初期化        */
  105.     if ((ret = MMI_initDialogL40()) < 0)
  106.         return ret ;
  107.     /*    メッセージ型部品の初期化        */
  108.     if ((ret = MMI_initMessageL40()) < 0)
  109.         return ret ;
  110.     /*    ボタン型部品の初期化            */
  111.     if ((ret = MMI_initButtonL40()) < 0)
  112.         return ret ;
  113.     /*    ドロウボタン型部品の初期化        */
  114.     if ((ret = MMI_initDrawButtonL40()) < 0)
  115.         return ret ;
  116.     /*    アイコンボタン型部品の初期化    */
  117.     if ((ret = MMI_initIconL40()) < 0)
  118.         return ret ;
  119.  
  120.     /*    背景データの初期化                        */
  121.  
  122.     /*    データの登録        */
  123.     if ((ret = MMI_Init(&initDataGUI)) < 0)
  124.         return ret ;
  125.  
  126.     //    Tmenuにパレットを合わせる
  127.     EIN_initGuiColor();
  128.  
  129.     MMI_SendMessage(iconMessageID, MM_SETMSG,1,msg) ;
  130.  
  131.     /*    背景を表示する                            */
  132.     MMI_SendMessage(MMI_GetBaseObj(), MM_SHOW, 0) ;
  133.  
  134.     MMI_SendMessage(MMI_GetBaseObj(), MM_SETEXEC, 1, userFunc);
  135.     MMI_CallMessage(MMI_GetApliId(), GM_TITLE, (int)"burden                          By 機拡", 0);
  136.  
  137.     extern void    userIdleTask();
  138.     MMI_SetIdleTaskFunc( userIdleTask );
  139.     beforeTime = MOS_getTime();
  140.     userIdleTask();
  141.  
  142.     return NOERR ;
  143. }
  144.  
  145. void userIdleTask(void)
  146. {
  147.     register unsigned int i;
  148.  
  149.     afterTime = MOS_getTime();
  150.  
  151.     i = afterTime - beforeTime;
  152.  
  153.     msg[0] = '0' + ((i/100)%10);
  154.     msg[1] = '0' + ((i/ 10)%10);
  155.     msg[2] = '0' + ( i     %10);
  156.     MMI_SendMessage(iconMessageID,MM_SHOW,0);
  157.  
  158.     beforeTime = afterTime;
  159.  
  160.     return ;
  161. }
  162.  
  163. /*    initDataGUI:iconQuitIconID:MJ_ICONL40の呼び出し関数    */
  164. int    iconQuitFunc(kobj, messId, argc, pev, trigger)
  165. int        kobj ;
  166. int        messId ;
  167. int        argc ;
  168. EVENT    *pev ;
  169. int        trigger ;
  170. {
  171.     MMI_SetHaltFlag(TRUE);
  172.     quitFuncRet = NOERR ;
  173.  
  174.     return NOERR ;
  175. }
  176.  
  177.